package com.app.brilliant.sign.config;

import com.app.brilliant.sign.interceptor.SignInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class DefaultMvcConfig implements WebMvcConfigurer {
    @Resource
    private SignInterceptor signInterceptor;

    /**
     * @description:
     * addInterceptor，signInterceptor
     * addPathPatterns。拦截该请求路径的请求
     * excludePathPatterns，不拦截此路径的请求
     * @date: 15:23 2022/12/23
     * @author: ZHX
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(signInterceptor)
//                .addPathPatterns("/**");      //这里所有请求都需要进行报文签名sign
    }
}